package top.drinyeit.nongmao.fragment;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;

import java.util.HashMap;
import java.util.Map;

import top.drinyeit.nongmao.R;
import top.drinyeit.nongmao.base.LazyFragment;
import top.drinyeit.nongmao.presenter.StoreHomePresenter;

/**
 * Created by wu on 2018/1/10.
 */

public class StoreHomeFragment extends LazyFragment{

    private int storeId;
    public RecyclerView mRecyclerView;
    private StoreHomePresenter storeHomePresenter;

    @Override
    protected int attachLayoutRes() {
        return R.layout.fragment_store_home;
    }

    @Override
    protected void initViews() {
        initIntent();
        mRecyclerView = mRootView.findViewById(R.id.mRecyclerView);
    }

    @Override
    protected void lazyLoad() {
        storeHomePresenter = new StoreHomePresenter(this);
        Map<String,Object> map = new HashMap<>();
        map.put("action","commodity_store_home");
        map.put("store_id",storeId);
        storeHomePresenter.getStoreHome(map);
    }

    private void initIntent(){
        Bundle bundle = getActivity().getIntent().getExtras();
        storeId = bundle.getInt("store_id");
    }

}
